extends layout

block headContent
	title Block Analysis

block content
	+pageTitle("Block Analysis")

	div.card.shadow-sm.mb-huge
		div.card-body
			h6.mb-3 Search for a block by height or hash to see a summary analysis of the transactions within that block.

			div.mb-3
				form.form.form-inline(method="get", action="./block-analysis")
					input(type="hidden", name="_csrf", value=csrfToken)

					div.input-group
						input.form-control(id="input-value", type="text", name="query", placeholder="block height/hash", value=(query), style="width: 400px;")
						
						button.btn.btn-primary(type="submit", aria-label="Go") Go

			hr.my-4

			if (global.prunedBlockchain)
				div.alert.alert-primary.pb-0(role="alert")
					h6.mb-2 Note About Pruning
					- var msgMarkdown = `Blockchain \`pruning\` is enabled on your node. This setting tells your node that after validating transactions it may discard data that is non-essential for future validation needs.\n\nThe current \`prune height\` for your node is ${global.pruneHeight.toLocaleString()}, and a block analysis will fail for any block height earlier than that.`;
					| !{markdown(msgMarkdown)}

			else

				h6 Selection of example blocks:

				- var heights = [0, 170, 100000, 210000, 420000, 481824];
				ul
					each height in heights
						li
							a(href=`./block-analysis/${height}`) Block ##{height.toLocaleString()}

block endOfBody
	script.
		$(document).ready(function() {
			$("form").submit(function() {
				window.location.href = `./block-analysis/${$("#input-value").val()}`;

				return false;
			});
		});
